﻿Public Class FrmDangNhap

    ' TODO: Insert code to perform custom authentication using the provided username and password 
    ' (See http://go.microsoft.com/fwlink/?LinkId=35339).  
    ' The custom principal can then be attached to the current thread's principal as follows: 
    '     My.User.CurrentPrincipal = CustomPrincipal
    ' where CustomPrincipal is the IPrincipal implementation used to perform authentication. 
    ' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
    ' such as the username, display name, etc.

    Private Sub btnThoat_Click(sender As Object, e As EventArgs) Handles btnThoat.Click
        Close()
    End Sub
    Public dto As New DangNhapDTO()
    Private Sub btnDangNhap_Click(sender As Object, e As EventArgs) Handles btnDangNhap.Click
        dto = DangNhapBUS.GetDangNhap(txtDangNhap.Text)

        If dto.ID = String.Empty Then
            MessageBox.Show("Tên Đăng Nhập Không Tồn Tại")
            Return
        End If
        Dim _t As String = dto.PW
        Dim _e As String = txtMK.Text
        If (dto.PW <> txtMK.Text) Then
            MessageBox.Show("Sai Mật Khẩu")
            Return
        Else

            Dim frm As New frmMain()
            frm.Show()
            Me.Hide()
        End If

    End Sub

    Private Sub PasswordTextBox_KeyDown(sender As Object, e As KeyEventArgs) Handles txtMK.KeyDown
        If e.KeyCode = Keys.Enter Then
            btnDangNhap_Click(e, New EventArgs())
        End If
    End Sub
End Class
